Warn when loading .el files without lexical-binding declaration
authorMattias Engdegård <mattiase@acm.org>
Fri, 3 May 2024 15:58:44 +0000 (17:58 +0200)
committerMattias Engdegård <mattiase@acm.org>
Fri, 3 May 2024 17:27:26 +0000 (19:27 +0200)
commit81bad84a617be38459da313a75719b5627bb15fe
treeb51c9ca6d4fc68e8b6a865c698fafce92aa19244
parentb6d4e81a487ce40f5ea6520c53a88a1c2e7359a9
Warn when loading .el files without lexical-binding declaration

This corresponds to the byte-compiler warning for the same issue,
here emitted for files that aren't compiled but loaded from source.
It should make the planned change to enable lexical binding by default
in Emacs 31 go smoother.

* src/lread.c (lexical_cookie_t): New type.
(lisp_file_lexically_bound_p): Renamed to...
(lisp_file_lexical_cookie): ...this, with the return value retyped.
* src/lread.c (warn_missing_cookie): New.
(Fload): Warn when loading source file and cookie missing.
(Feval_buffer): Add LOADING arg; warn when set and cookie missing.
* lisp/international/mule.el (load-with-code-conversion):
* lisp/startup.el (command-line--load-script):
Call eval-buffer with LOADING arg set.
* etc/NEWS: Announce.
etc/NEWS
lisp/international/mule.el
lisp/startup.el
src/lread.c